<template>
	<view>
		<scroll-view scroll-x class="bg-white nav">
			<view class="flex text-center">
				<view class="cu-item flex-sub" :class="index==TabCur?'text-purple cur':''"
					v-for="(item,index) in tabList" :key="index" @tap="tabSelect" :data-id="index">
					{{item}}
				</view>
			</view>
		</scroll-view>
		<view class="cu-bar search bg-white">
		    <view class="search-form round">
		      <text class="cuIcon-search"></text>
		      <input type="text" placeholder="搜索我要的资源" v-model="content" confirm-type="search"></input>
		    </view>
		    <view class="action">
			  <text>搜索</text>
		      <!-- <text v-else>取消</text> -->
		    </view>
		  </view>
		  <view class="cu-list menu-avatar solid-bottom">
		  	<view class="cu-item" v-for="(item,index) in dataList">
		  		<view class="cu-avatar round lg"
		  			:style="{backgroundImage:'url('+item.headimg+')'}">
		  		</view>
		  		<view class="content flex-sub">
		  			<view>{{item.realname.substring(0,1)}}公子-{{item.realname}}</view>
		  			<view class="text-gray text-sm flex justify-between">
		  				{{item.touxian1}}
		  			</view>
		  		</view>
				<view class="btn-guanzhu">
					<text v-if="index==0">
						互相关注
					</text>
					<text v-else>
						添加好友
					</text>
				</view>
		  	</view>
			</view>
		  <!-- <nodata v-if="pinkDataList.length==0"></nodata> -->
	</view>
</template>

<script>
	var app = getApp();
	export default {
		data() {
			return {
				TabCur:0,
				content:"",
				tabList: ['待添加朋友', '朋友列表'],
				dataList:[]
			};
		},
		onLoad(e) {
			// this.TabCur = e.index
			this.getDataList()
		},
		methods: {
			getDataList(){
				app.post("ApiMingpian/mingpianlist",{jibie:this.jibie},(res)=>{
					console.log(res)
					if(res.status==1){
						this.dataList = res.data
					}
					// res.data[0].latitude=28.22778;
					// res.data[0].longitude= 112.93886;
					// this.positions = res.data
				})
			},
			InputFocus(e) {
				this.InputBottom = e.detail.height
			},
			InputBlur(e) {
				this.InputBottom = 0
			},
			tabSelect(e) {
				this.jibie = parseInt(e.currentTarget.dataset.id) + 1;
				this.TabCur = e.currentTarget.dataset.id;
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
				// this.dataList=[]
				this.getDataList()
			}
		}
	}
</script>

<style lang="less">
	.btn-guanzhu{
		border:1rpx solid #d4d4d4;
		border-radius: 50rpx;
		padding: 10rpx 15rpx;
		font-size: 0.8rem;
	}
</style>
